Thread: return type of 'main' is not `int'

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Feb 2010
    Posts
    37
    Just change the return type of main from void to int
    Code:
    #include<stdio.h>
    #include<math.h>
    #include<limits.h>
    #include<stdlib.h>
    int main()
    {
            double pi,x,y;
    
            pi=atan(1.0)*4.0;
            printf("acos(0.5)  %lf\n",acos(0.5));
            printf("asin(0.5)  %lf\n",asin(0.5));
            printf("atan2(-2.0,1.0)  %lf\n",atan2(-2.0,1.0));
            printf("abs(-7)  %d\n",abs(-7));
            printf("ceil(-3.3)  %lf\n",ceil(-3.3));
            printf("exp(0.5)  %lf\n",exp(0.5));
            printf("fabs(-3.3)  %lf\n",fabs(-3.3));
            printf("floor(-3.3)  %lf\n",floor(-3.3));
            printf("log(0.5)  %lf\n",log(0.5));
            printf("log10(0.5)  %lf\n",log10(0.5));
            printf("pow(2.0,3.5)  %lf\n",pow(2.0,3.5));
            printf("%d  %d\n",RAND_MAX,rand());
            printf("sqrt(0.5)  %lf\n",sqrt(0.5));
            printf("%e\n",HUGE_VAL);
    }
    And cc -lm program_name.c

    Now the program gives the following output
    Code:
    acos(0.5)  1.047198
    asin(0.5)  0.523599
    atan2(-2.0,1.0)  -1.107149
    abs(-7)  7
    ceil(-3.3)  -3.000000
    exp(0.5)  1.648721
    fabs(-3.3)  3.300000
    floor(-3.3)  -4.000000
    log(0.5)  -0.693147
    log10(0.5)  -0.301030
    pow(2.0,3.5)  11.313708
    2147483647  1804289383
    sqrt(0.5)  0.707107
    inf
    Last edited by thillai_selvan; 03-02-2010 at 05:30 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Conversion of pointers to functions
    By hzmonte in forum C Programming
    Replies: 0
    Last Post: 01-20-2009, 01:56 AM
  2. Using VC Toolkit 2003
    By Noobwaker in forum Windows Programming
    Replies: 8
    Last Post: 03-13-2006, 07:33 AM
  3. C++ FTP class won't work
    By lord mazdak in forum C++ Programming
    Replies: 8
    Last Post: 12-18-2005, 07:57 AM
  4. Pong is completed!!!
    By Shamino in forum Game Programming
    Replies: 11
    Last Post: 05-26-2005, 10:50 AM
  5. OpenGL and Windows
    By sean345 in forum Game Programming
    Replies: 5
    Last Post: 06-24-2002, 10:14 PM